<template>
    <div class="workers">
        <div
            class="scan-style"
            v-for="(item, index) in list"
            :key="index"
            @click="routerTo(item)"
        >{{ item.name }}</div>
    </div>
</template>
<script>
import { Toast } from 'vant'
import { mzMenulist } from '../../api/gov/home/index'
export default {
  name: 'component_name',
  data () {
    return {
      isInAndOuts: '',
      cardNo: '',
      list: []
    }
  },
  mounted () {
    this.isInAndOuts = this.$route.query.value
    this.cardNo = this.$route.query.cardNo
    this.getMzMenulist()
  },
  methods: {
    // 获取菜单
    getMzMenulist () {
      mzMenulist().then((res) => {
        if (res.data.errcode == 0) {
          this.list = res.data.data.list
          if (res.data.data.list.length == 0) {
            Toast.success('您无权限')
            setTimeout(() => {
              this.$router.go(-1)
            }, 200)
          }
        }
      })
    },
    routerTo (item) {
      this.$router.push({ name: 'audit', query: { cardNo: this.cardNo, value: this.isInAndOuts, worker_type: item.path } })
    }
  }
}
</script>
<style scoped lang="less">
.workers {
    height: 100vh;
    display: flex;
    // justify-content: center;
    align-items: center;
    flex-direction: column;
    background: url("../../assets/images/bl.png") no-repeat;
    background-size: 100% 100%;
    .scan-style {
        width: 85vw;
        height: 200px;
        background: #469af0;
        color: white;
        border-radius: 20px;
        text-align: center;
        line-height: 200px;
    }
    .scan-style:nth-child(1){
      margin-top: 120px;
    }
    .scan-style:nth-child(2){
      margin-top: 60px;
    }
    .scan-style:nth-child(3){
       margin-top: 60px;
    }
}
</style>
